Skip to content

[fix] refine site url determination logic#128

Merged
InayaY3 merged 2 commits intomainfrom
jinkang/fix-supabase-email
Mar 8, 2026
Merged

[fix] refine site url determination logic#128
InayaY3 merged 2 commits intomainfrom
jinkang/fix-supabase-email

Conversation

@jinkang-0
Copy link
Contributor

What's new in this PR

Description

  • Refine the logic that determines the current site URL depending on the deployment environment
  • This fix should fix issues with the reset password link leading to a private preview URL

How to review

The nature of the feature requires testing after production. The site URL is determined as "http://localhost:3000/" if it detects it is not deployed by Vercel. If it is deployed in a preview environment by Vercel, the site URL will be the preview URL. If it is deployed in production, it will use the production URL.

For a complete test, the forgot password email link should be tested after this PR is merged.

Relevant links

CC: @ethan-tam33

@vercel
Copy link

vercel bot commented Dec 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
adopt-an-inmate Ready Ready Preview, Comment Mar 4, 2026 11:13pm

@InayaY3 InayaY3 self-requested a review March 4, 2026 06:47
Copy link
Member

@InayaY3 InayaY3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still doesn't work on the previews for me, but at least it doesn't redirect to the local link anymore. ik this was intended to fix for local testing + production testing, so i'm still okay to merge this in since it seems to be working for those. thoughts on what it could be?

Screenshot 2026-03-06 at 7 57 10 PM (also tried again, still showed this screen but instead said the link was invalid or smt)

@jinkang-0
Copy link
Contributor Author

jinkang-0 commented Mar 7, 2026

still doesn't work on the previews for me, but at least it doesn't redirect to the local link anymore. ik this was intended to fix for local testing + production testing, so i'm still okay to merge this in since it seems to be working for those. thoughts on what it could be?

It's odd, I referenced the docs again and it mentioned to use the "PASSWORD_RECOVERY" event. However, I recall the events triggered were just "SIGNED_IN" or "INITIAL_SESSION"... It could've been that Supabase patched a bug or updated the functionality. I do remember the flow working before though.

Nonetheless, I think the functionality this PR is intended to do is to fix the site URL determination code, which seems to be working (at least for localhost and preview). We should investigate the forgot password flow deeper as a separate issue.

Copy link
Member

@InayaY3 InayaY3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will have to investigate the forgot password flow particularly on vercel previews, but otherwise LGTM

@InayaY3 InayaY3 merged commit ff90e59 into main Mar 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants